Rename fields in physinfo_t structure and add sockets/nodes
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 4 Jul 2005 16:02:46 +0000 (16:02 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 4 Jul 2005 16:02:46 +0000 (16:02 +0000)
fields.

tools/python/xen/lowlevel/xc/xc.c
tools/python/xen/xend/XendNode.py
tools/xentrace/xentrace.c
xen/arch/x86/dom0_ops.c
xen/include/public/dom0_ops.h

index 89035c12be306f9599a35121eb50de880929aa88..dbd8c06b5a05ab9402dc84891c2f364cc6d46a50 100644 (file)
@@ -47,7 +47,8 @@ static PyObject *pyxc_domain_dumpcore(PyObject *self,
 
     static char *kwd_list[] = { "dom", "corefile", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list, &dom, &corefile) )
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list,
+                                      &dom, &corefile) )
         goto exit;
 
     if ( (corefile == NULL) || (corefile[0] == '\0') )
@@ -82,7 +83,8 @@ static PyObject *pyxc_domain_create(PyObject *self,
 
     static char *kwd_list[] = { "dom", "ssidref", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list, &dom, &ssidref))
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
+                                      &dom, &ssidref))
         return NULL;
 
     if ( (ret = xc_domain_create(xc->xc_handle, ssidref, &dom)) < 0 )
@@ -687,11 +689,13 @@ static PyObject *pyxc_physinfo(PyObject *self,
         return PyErr_SetFromErrno(xc_error);
 
     return Py_BuildValue("{s:i,s:i,s:l,s:l,s:l}",
-                         "ht_per_core", info.ht_per_core,
-                         "cores",       info.cores,
-                         "total_pages", info.total_pages,
-                         "free_pages",  info.free_pages,
-                         "cpu_khz",     info.cpu_khz);
+                         "threads_per_core", info.threads_per_core,
+                         "cores_per_socket", info.cores_per_socket,
+                         "sockets_per_node", info.sockets_per_node,
+                         "nr_nodes",         info.nr_nodes,
+                         "total_pages",      info.total_pages,
+                         "free_pages",       info.free_pages,
+                         "cpu_khz",          info.cpu_khz);
 }
 
 static PyObject *pyxc_sedf_domain_set(PyObject *self,
@@ -702,12 +706,15 @@ static PyObject *pyxc_sedf_domain_set(PyObject *self,
     u32 domid;
     u64 period, slice, latency;
     u16 extratime, weight;
-    static char *kwd_list[] = { "dom", "period", "slice", "latency", "extratime", "weight",NULL };
+    static char *kwd_list[] = { "dom", "period", "slice",
+                                "latency", "extratime", "weight",NULL };
     
-    if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLLhh", kwd_list, &domid,
-                                     &period, &slice, &latency, &extratime, &weight) )
+    if( !PyArg_ParseTupleAndKeywords(args, kwds, "iLLLhh", kwd_list, 
+                                     &domid, &period, &slice,
+                                     &latency, &extratime, &weight) )
         return NULL;
-   if ( xc_sedf_domain_set(xc->xc_handle, domid, period, slice, latency, extratime,weight) != 0 )
+   if ( xc_sedf_domain_set(xc->xc_handle, domid, period,
+                           slice, latency, extratime,weight) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
     Py_INCREF(zero);
index d915f0ba0f201c9462a4b7574d9a4b3bddca472f..2d62f12f4eb1df654dba308c167e86370399b403 100644 (file)
@@ -43,8 +43,8 @@ class XendNode:
 
     def physinfo(self):
         pinfo = self.xc.physinfo()
-        info = [['cores', pinfo['cores']],
-                ['hyperthreads_per_core', pinfo['ht_per_core']],
+        info = [['cores_per_socket', pinfo['cores_per_socket']],
+                ['threads_per_core', pinfo['threads_per_core']],
                 ['cpu_mhz', pinfo['cpu_khz']/1000],
                 ['memory', pinfo['total_pages']/256],
                 ['free_memory', pinfo['free_pages']/256]]
index 50988c90f8b7a423820f42fd22e2e127a12d1cfd..f8236a22e056e09519cf74b62db87ba55dcf1046 100644 (file)
@@ -273,7 +273,10 @@ unsigned int get_num_cpus()
 
     xc_interface_close(xc_handle);
 
-    return op.u.physinfo.ht_per_core * op.u.physinfo.cores;
+    return (op.u.physinfo.threads_per_core *
+            op.u.physinfo.cores_per_socket *
+            op.u.physinfo.sockets_per_node *
+            op.u.physinfo.nr_nodes);
 }
 
 
index 7ca358d69bec0317ffd662fbfe56304979cb3b8a..ff606ca1c7811352a66dd73385439a443fe0d1a8 100644 (file)
@@ -179,11 +179,14 @@ long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op)
     {
         dom0_physinfo_t *pi = &op->u.physinfo;
 
-        pi->ht_per_core = smp_num_siblings;
-        pi->cores       = boot_cpu_data.x86_num_cores;
-        pi->total_pages = max_page;
-        pi->free_pages  = avail_domheap_pages();
-        pi->cpu_khz     = cpu_khz;
+        pi->threads_per_core = smp_num_siblings;
+        pi->cores_per_socket = boot_cpu_data.x86_num_cores;
+        pi->sockets_per_node = 
+            num_online_cpus() / (pi->threads_per_core * pi->cores_per_socket);
+        pi->nr_nodes         = 1;
+        pi->total_pages      = max_page;
+        pi->free_pages       = avail_domheap_pages();
+        pi->cpu_khz          = cpu_khz;
 
         copy_to_user(u_dom0_op, op, sizeof(*op));
         ret = 0;
index 255e098e1aedc1b7e1f95c9c90f6068d46d6e452..19ad0efab584b28cb9ef9c6c2f2364911f86fffb 100644 (file)
@@ -19,7 +19,7 @@
  * This makes sure that old versions of dom0 tools will stop working in a
  * well-defined way (rather than crashing the machine, for instance).
  */
-#define DOM0_INTERFACE_VERSION   0xAAAA1009
+#define DOM0_INTERFACE_VERSION   0xAAAA100A
 
 /************************************************************************/
 
@@ -206,8 +206,10 @@ typedef struct {
  */
 #define DOM0_PHYSINFO         22
 typedef struct {
-    u32      ht_per_core;
-    u32      cores;
+    u32      threads_per_core;
+    u32      cores_per_socket;
+    u32      sockets_per_node;
+    u32      nr_nodes;
     u32      cpu_khz;
     memory_t total_pages;
     memory_t free_pages;